import Vue from 'vue'
import App from './App'

import store from './store'

Vue.config.productionTip = false

Vue.prototype.$store = store

App.mpType = 'app'

import uView from "uview-ui";
Vue.use(uView);

const app = new Vue({
	store,
	...App
})
// http拦截器，此为需要加入的内容，如果不是写在common目录，请自行修改引入路径
import httpInterceptor from '@/common/http.interceptor.js'
Vue.use(httpInterceptor, app)

Vue.filter("formatDate",(time)=>{
	const date = new Date(time);
	const year = date.getFullYear()
	const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
	const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
	return year + '-' + month + '-' + day
})
// http接口API抽离，免于写url或者一些固定的参数
import httpApi from '@/common/http.api.js'

// import * as mqtt from "./common/mqttApp.js";
// Vue.prototype.$mqtt = mqtt;
// mqtt.initMqtt();

Vue.use(httpApi, app)
app.$mount()
